Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Utf8Formatter to Span<T>.Fill #52591

Closed
wants to merge 2 commits into from
Closed

Conversation

xtqqczze
Copy link
Contributor

Follow-up to #51365.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@@ -43,7 +43,8 @@ private static bool TryFormatUInt64D(ulong value, byte precision, Span<byte> des

if (leadingZeroCount > 0)
{
FormattingHelpers.FillWithAsciiZeros(destination.Slice(0, leadingZeroCount));
// Fill with ASCII zeros
destination.Slice(0, leadingZeroCount).Fill((byte)'0');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that Utf8Formatter is typically going to use this method for very small sizes. Is Array.Fill faster for these small sizes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run some tests, it seems the for loop may be faster for leadingZeroCount < 8.

@eerhardt
Copy link
Member

Failures of the following form:

You cannot extract a file outside of the target path

are #52596

@xtqqczze xtqqczze marked this pull request as draft May 12, 2021 03:17
@ghost ghost closed this Jun 11, 2021
@ghost
Copy link

ghost commented Jun 11, 2021

Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 11, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants